<%@language=vbscript%>
<%
	Session("bChucnang")=4
	Session("FormName")="F21"
%>
<!--#include file="..\CheckSession.inc"-->
<!--#include file="..\RootContent.inc"-->
<!--#include file=..\getFormName.inc-->
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>VAN THU QUYET DINH</title>
</head>
<%	chuyendi=request("chuyendi")
	backform=request("backform")+1
	bDangky=Request("bDangky")
	Dim Msg
	bComm=Request("bComm")	
	bPhanLoai=Request("ComboPhanloai")
	if bComm="edit" then
		bOutnum=Request("TxtOutNum")
		bOutSymbol=Request("TxtOutSymbol")
		bSoghinhan=trim(bOutnum) & "/" & trim(bOutSymbol)
		'bSoghinhan=Request("TxtSoghinhan")
		bID=Request("TxtID")
		sSQL="Select * from VTQuyetdinh Where ID Like '"& bID &"'"
		Set RecT=Server.CreateObject("ADODB.Recordset")
		RecT.CursorType=3
		RecT.CacheSize=5
		RecT.Open sSQL,Conn
		Dim bDisplay
		bDisplay=False
		if RecT.RecordCount>0 then
			dim bSoghinhan
			Dim bID
			Dim bSogoccu
			Session("bMaVBDi")=RecT("ID")	
			Session("bTenVBDi")=RecT("Trichyeu")		
			bSoghinhan=trim(RecT("soghinhan"))
			bOutNum=cstr(RecT("so"))
			bOutnumcu=bOutNum
			bOutSymbol=right(bSoghinhan,len(bSoghinhan)-len(bOutNum)-1)
			bID=RecT("ID")		
			bSoghinhancu=RecT("soghinhan")			
			bIDcu=RecT("ID")		
			bTrichyeu=RecT("Trichyeu")
			bTomtat=RecT("Tomtat")
			bTinhchat=RecT("Tinhchat")
			bTinhchat1=RecT("Tinhchat1")
			bTentep=RecT("Tentep")
			bTentepcu=RecT("Tentep")
			bNguoiky=RecT("Nguoiky")
			bNGayky=RecT("Ngayky")
			bNGaydi=RecT("Ngaydi")
			bNam=year(RecT("Ngaydi"))
			bNamcu=year(RecT("Ngaydi"))
			bNguoinhan=RecT("Nguoinhan")
			bTukhoa=RecT("Tukhoa")
			bReadwrite=RecT("congcong")
			bCongcong=RecT("congcong")
			bTTDuyet=RecT("trangthaiduyet")
			bDiachiluutru=RecT("diachiluutru")
			bPhanloai=RecT("phanLoai")
			bPhanloaicu=RecT("Phanloai")
			bSoban=RecT("Soban")
			bSoto=RecT("Soto")
			bSLNoidung=RecT("Soluongnoidung")
			bNoinhan=RecT("Noinhan")
			bDisplay=true
			bBaocao=Rect("Baocao")
			bSelect1=rect("DVSoan")
			bSelect2=rect("noinhan")
		end if
	end if
	Dim bTonTai
	Select case bComm
		case "okedit"
			bOutnum=Request("TxtOutNum")			
			bOutSymbol=Request("TxtOutSymbol")
			bTrichyeu=trim(Request("TxtTrichyeu"))
			bTomtat=trim(Request("TxtTomtat"))
			bTinhchat=Request("ComboTinhchat")
			bTinhchat1=Request("ComboTinhchat1")
			bTentep=Request("TxtTentep")
			bNguoiky=trim(Request("TxtNguoiky"))
			bNGayky=request("TxtNgayky")
			bNGaydi=request("TxtNgaydi")
			bNam=year(request("TxtNgaydi"))
			
			bNguoinhan=trim(Request("TxtNguoinhan"))
			bTukhoa=trim(Request("TxtTukhoa"))
			bReadwrite=Request("bReadwrite")
			bnoinhan=trim(Request("TxtNoinhan"))
			if bReadwrite then
				bReadwrite=1
			else
				bReadwrite=0
			end if
			bCongcong=Request("congcong")
			if bCongcong then
				bCongcong=1
			else
				bCongcong=0
			end if
			bBaocao=Request("ChkBC")
			if bBaocao then	
				bBaocao=1
			else
				bBaocao=0
			end if
			bSoghinhancu=Request("bSoghinhancu")
			bIDcu=Request("bIDcu")
			bNamcu=request("bNamcu")
			bOutnumcu=request("bOutnumcu")
			bPhanloaicu=request("bPhanloaicu")
'			bDiachiluuTru=Request("Txtdiachiluutru")
			bDiachiluutru=0
			bPhanloai=Request("ComboPhanloai")
			bNhomCV=Request("ComboNhomCV")
			bNhomCVCU=Request("bNhomCVcu")
			bTTDuyet=Request("bTTDuyet")
			bSoban=Request("TxtSoban")
			bSoto=Request("TxtSoto")
			bSelect1=Request("Select1")
			bSelect2=Request("Select2")
			if bTTDuyet then
				bTTDuyet=1
			else
				bTTDuyet=0
			end if
			bSLNoidung=Request("TxtSLNoidung")
			if Request("filename")<>"" then
				bTentepcu=Request("filename")
			end if
			bSoghinhan=bOutnum+"/"+bOutSymbol
			Temp=bSoghinhan			
			bNguoiduyet=Session("bMaCB")
			bNgayky=SaveDate(bNgayky)
			bNgaydi=SaveDate(bNgaydi)
			On Error resume next
			Conn.BeginTrans
			if (trim(CSTR(boutnum)=trim(CSTR(boutnumcu))))  and (trim(CSTR(bNamcu))=trim(CSTR(bnam))) and (bPhanloaicu=bPhanloai) then
				bID="QD"+cstr(bNam)+"_"+cstr(bPhanloai)+"_"+cstr(bOutnum)
				bTentep=bID+".VT"
				sSQL="Update VTQuyetdinh set ID='"& bID &"',Soghinhan='"& bSoghinhan &"', ngaydi='"& bNgaydi &"', ngayky='"& bNgayky _
					&"',Nguoiky='"& ModiString(trim(bNguoiky)) _
					&"',Tomtat='"& ModiString(trim(bTomtat)) &"',Trichyeu='"& ModiString(bTrichyeu) &"',Tukhoa='"& ModiString(bTukhoa) _
					&"',Nguoinhan='"& ModiString(bNguoinhan) _
					&"',Tinhchat='"& ModiString(bTinhchat) _
					&"',Tinhchat1='"& ModiString(bTinhchat1) _
					&"',phanLoai="& bPhanloai _
					&",Tentep='"& ModiString(bTentep) _
					&"',Soban='"& ModiString(bSoban) _
					&"',Soto='"& ModiString(bSoto) _
					&"',diachiluutru="& bDiachiluutru _
					&",Congcong="& bReadwrite _
					&",trangthaiduyet="& bTTDuyet _
					&",Nguoiduyet='"& bNguoiduyet _
					&"',DVSoan='"& bSelect1 _
					&"',noinhan='"& bSelect2 _
					&"',Baocao="& bBaocao _
					&" Where ID ='"& bIDcu &"'" 
				Conn.Execute sSQL

				'Msg="N&#7897;i dung &#273;&#227; &#273;&#432;&#7907;c s&#7917;a"
				bComm="edit"
			end if
			if (trim(cstr(bOutnum)<>trim(cstr(bOutnumcu))))  and (trim(bNamcu)=trim(bnam)) and (bPhanloaicu=bPhanloai) then
				bID="QD"+cstr(bNam)+"_"+cstr(bPhanloai)+"_"+cstr(bOutnum)
				bTentep=bID+".VT"
				Temp=bID
				if KTSoghinhan(bOutnum,bPhanloai,bNam,"okedit") then
					Msg="M&#227; s&#7889; ghi nh&#7853;n &#273;&#227; t&#7891;n t&#7841;i"
					bTontai=True
					bDisplay=true
					bComm="edit"
					bIDcu=request("bIDcu")
					bNamcu=request("bNamcu")
					bPhanloaicu=request("bPhanloaicu")
					bNhomCVCu=request("bNhomCVcu")
					bOutnumcu=request("bOutnumcu")
					bSoghinhancu=request("bSoghinhancu")
					bOutnum=bOutnumcu
					bID=bIDcu
				else
					'Msg="N&#7897;i dung &#273;&#227; &#273;&#432;&#7907;c s&#7917;a"
					bTonTai=false
					bComm="edit"					
				end if	
				if not bTontai then
					sSQL="Update VTQuyetdinh set so="& bOutnum &" ,ID='"& ModiString(bID)&"',Soghinhan='"& ModiString(bSoghinhan) _
						&"', ngaydi='"& bNgaydi &"',ngayky='"& bNgayky _
						&"',Nguoiky='"& ModiString(trim(bNguoiky)) _
						&"',Tomtat='"& ModiString(trim(bTomtat)) &"',Trichyeu='"& ModiString(bTrichyeu) &"',Tukhoa='"& ModiString(bTukhoa) _
						&"',Nguoinhan='"& ModiString(bNguoinhan) _
						&"',Tinhchat='"& ModiString(bTinhchat) _
						&"',Tinhchat1='"& ModiString(bTinhchat1) _
						&"',Soto='"& ModiString(bSoto) _
						&"',Soban='"& ModiString(bSoban) _
						&"',Phanloai="& bPhanloai _
						&",Tentep='"& ModiString(bTentep) _
						&"',diachiluutru="& bDiachiluutru _
						&",Congcong="& bReadwrite _
						&",trangthaiduyet="& bTTDuyet _
						&",Nguoiduyet='"& bNguoiduyet _
						&"',DVSoan='"& bSelect1 _
						&"',noinhan='"& bSelect2 _
						&"',Baocao="& bBaocao _
						&" Where ID ='"& bIDcu &"'" 
						Conn.Execute sSQL			
					bSoghinhancu=bSoghinhan
					bUpdate=true			
				end if
			end if
			if  (trim(cstr(bNamcu))<>trim(cstr(bnam))) or (bPhanloaicu<>bPhanloai) then
				sSQL="Select * from VTQuyetdinh where year(ngaydi)='"& bNam &"' and phanloai="& bPhanloai &"  order by so"
				Set RecTD=server.createobject("ADODB.Recordset")
				RecTD.cursorType=3
				RecTD.Cachesize=5
				RecTD.open sSQL,Conn					
				if (not RecTD.EOF) and (not RecTD.BOF) then
					RecTD.MOvelast
					bOutnum=cstr(clng(RecTD("so"))+1)												
				else
					bOutnum="1"
				end if
				RecTD.close
				Set RecTD=nothing
				bSoghinhan=bOutNum+"/"+bOutSymbol
				Temp=bSoghinhan
				bID="QD"+cstr(bNam)+"_"+cstr(bPhanloai)+"_"+cstr(bOutnum)
				bTentep=bID+".VT"
				sSQL="Update VTQuyetdinh set so="& bOutnum &" ,ID='"& ModiString(bID) &"',Soghinhan='"& ModiString(bSoghinhan) _
						&"', ngaydi='"& bNgaydi &"',ngayky='"& bNgayky _
						&"',Nguoiky='"& ModiString(trim(bNguoiky)) _
						&"',Tomtat='"& ModiString(trim(bTomtat)) &"',Trichyeu='"& ModiString(bTrichyeu) &"',Tukhoa='"& ModiString(bTukhoa) _
						&"',Nguoinhan='"& ModiString(bNguoinhan) _
						&"',Tinhchat='"& ModiString(bTinhchat) _
						&"',Tinhchat1='"& ModiString(bTinhchat1) _
						&"',soban='"& ModiString(bSoban) _
						&"',Soto='"& ModiString(bSoto) _
						&"',Phanloai="& bPhanloai _
						&",Tentep='"& ModiString(bTentep) _
						&"',diachiluutru="& bDiachiluutru _
						&",Congcong="& bReadwrite _
						&",trangthaiduyet="& bTTDuyet _
						&",Nguoiduyet='"& bNguoiduyet _
						&"',DVSoan='"& bSelect1 _
						&"',noinhan='"& bSelect2 _
						&"',Baocao="& bBaocao _
						&" Where ID ='"& bIDcu &"'" 
						Conn.Execute sSQL
				'Msg="N&#7897;i dung &#273;&#227; &#273;&#432;&#7907;c s&#7917;a"
				bComm="edit"
				bUpdate=true
			end if
			%><%=Err.description%><%					
			if bUpdate then
				sSQL="Update Muontra set BophanQL="& bDiachiluutru &",matailieu = '"& ModiString(bID) &"' where matailieu like '"& bIDcu &"' and Loaitailieu=2"
				Conn.Execute sSQL 
				sSQL="Update vanban_noidung set mavanthu='"& ModiString(bID) &"' where mavanthu Like '"& bIDcu &"' and loaivanthu='5'" 				
				Conn.Execute sSQL
				sSQL="Update Quyen set mavanthu='"& ModiString(bID) &"' where mavanthu Like '"& bIDcu &"' and maloaivanthu='5'" 				
				Conn.Execute sSQL
				sSQL="Update Quyen_nhom set mavanthu='"& ModiString(bID) &"' where mavanthu Like '"& bIDcu &"' and maloaivanthu='5'" 				
				Conn.Execute sSQL				
				'Sua File
				set TextFile=server.CreateObject("Activefile.file")
				PathOld=RootContent & "Upload\"& cstr(bNamcu) &"\QuyetDinh\Text"
				PathOld=Pathold & "\" & bIDcu & ".VT" 
				Path=RootContent & "Upload\"& cstr(bNam) &"\QuyetDinh\Text"
				Path=Path & "\" & bID & ".VT"
				'Tao thu muc nam moi
				Set bDir=server.CreateObject("ActiveFile.Directory")
		     	bPathFolder=RootContent & "Upload" & "\" & bNam
		          bDir.Path=bPathFolder
    				if not bDir.Exists() then
    				   	call bDir.Create(bPathFolder)
    				end if
	    			bPathFolder=bPathFolder & "\QuyetDinh"
				bDir.Path=bPathFolder
	     		if not bDir.Exists() then
					Call bDir.Create(bPathFolder)
				end if
				bPathFolder=bPathFolder & "\Text"
			    	bDir.Path=bPathFolder
				if not bDir.Exists() then
	   				Call bDir.Create(bPathFolder)
				end if
			     Set bDir=nothing		          							
				TextFile.Name=Path
				if TextFile.Exists() then
					TextFile.Delete()
				end if				
				TextFile.Name=PathOld	
				if TextFile.Exists() then
					Call TextFile.Copy (Path)				
				end if
				TextFile.Name=PathOld				
				if TextFile.Exists() then
					TextFile.Delete()
				end if
				sSQL="Select * from vanban_noidung where mavanthu Like '"& ModiString(bID) &"' and Loaivanthu='5'  order by Sothutu"			
				Set RecRename=server.CreateObject("ADODB.Recordset")
				RecRename.CursorType=3
				RecRename.CacheSize=5
				RecRename.Open sSQL,Conn
				Set Ex=server.CreateObject("Vinalines.ClsFile")
				Do while not RecRename.EOF					
					Pathold=RootContent & "Upload\"& Cstr(bNamcu) &"\QuyetDinh"
					Pathold=Pathold & "\" & bIDcu & "S" & trim(cstr(RecRename("sothutu"))) & "." & Ex.GetExtensionFile(RecRename("Tentep"))			
					Path=RootContent & "Upload\"& Cstr(bNam) &"\QuyetDinh"
					Path=Path & "\" & bID & "S" & trim(cstr(RecRename("sothutu"))) & "." & Ex.GetExtensionFile(RecRename("Tentep"))			
					TextFile.Name=Path
					if TextFile.Exists() then
						TextFile.delete()
					end if
					TextFile.Name=PathOld
					if TextFile.Exists() then
						call TextFile.Copy (Path)
						TextFile.Delete()
					end if
					bName=bID & "S" & trim(cstr(RecRename("sothutu"))) & "." & Ex.GetExtensionFile(RecRename("Tentep"))
					sSQL="Update vanban_noidung set Tentep='"& bName &"' where loaivanthu='5' and  Sothutu="& RecRename("sothutu") &" And mavanthu like '"& ModiString(bID) &"'"
					Conn.Execute sSQL				
					RecRename.MoveNext
				Loop
				%><%=Err.Description%><%
				RecRename.Close
				set RecRename=nothing
				set TextFile=nothing
				set Ex=nothing
				if bReadwrite then
					sSQL="Delete Quyen where maloaivanthu='5' and mavanthu like '"& ModiString(bID) &"'"
					Conn.Execute sSQL
					sSQL="Delete Quyen_nhom where maloaivanthu='5' and mavanthu like '"& ModiString(bID) &"'"
					Conn.Execute sSQL
				end if
			End if
			'Ket Thu Transaction
			if Err.number=0 then
				if Session("VanBan")="" then 
					Session("VanBan")="-" & Session("VanBan") & modistring(bID) & "-"
				else
					Session("VanBan")=Session("VanBan") & modistring(bID) & "-"
				end if
				Conn.CommitTrans
				btrangthai=1
			else
				Conn.RollbackTrans
				bTrangthai=0
			end if
			'Ghi nhan Ai da login thanh cong				
			bHoten=Session("bHoten")
			bNgaygio=cstr(Date()) &" "& cstr(Time())
			bChucnang="C&#7853;p nh&#7853;t V&#259;n th&#432; quyết định"
			bIDTailieu=bSoghinhan
			bDongtac="S&#7917;a"
			sSQL="insert into loguser(Tennguoisudung,ngaygio,chucnangdung,dongtac,IDTailieu,Trangthai) Values('"& bHoten _
				&"','"& bNgaygio &"','"& bChucnang &"','"& bDongtac &"','"& bIDTailieu &"',"& bTrangthai &")"
			Conn.Execute sSQL	
			
			bIDcu=bID
			bNamcu=bNam
			bPhanloaicu=bPhanloai
			bNhomCVcu=bNhomCV
			bOutnumcu=bOutnum
			Session("bMaVBQD")=bID
			Session("bTenVBQD")=bTrichyeu			
		case "okadd"
			bOutnum=Request("TxtOutNum")
			bOutSymbol=Request("TxtOutSymbol")
			bTrichyeu=trim(Request("TxtTrichyeu"))
			bTomtat=trim(Request("TxtTomtat"))
			bTinhchat=Request("ComboTinhchat")
			bTinhchat1=Request("ComboTinhchat1")
			bSoban=Request("TxtSoban")
			bSoto=Request("TxtSoto")
			bTentep=Request("TxtTentep")
			bNguoiky=trim(Request("TxtNguoiky"))
			bNgayky=request("TxtNgayky")
			bNgaydi=request("TxtNgaydi")
			bNam=year(Request("TxtNgaydi"))
			bNoinhan=trim(request("TxtNoinhan"))
			bNguoinhan=trim(Request("TxtNguoinhan"))
			bTukhoa=trim(Request("TxtTukhoa"))
			bReadwrite=Request("bReadwrite")			
			bSelect1=Request("Select1")
			bSelect2=Request("Select2")
			if bReadwrite then
				bReadwrite=1
			else
				bReadwrite=0
			end if
			bCongcong=Request("congcong")
			if bCongcong then
				bCongcong=1
			else
				bCongcong=0
			end if
			bBaocao=Request("ChkBC")
			if bBaocao then	
				bBaocao=1
			else
				bBaocao=0
			end if
'			bDiachiluutru=request("Txtdiachiluutru")
			bDiachiluutru=0
			bPhanloai=Request("ComboPhanloai")
			bNhomCV=Request("ComboNhomCV")
			bTTDuyet=Request("bTTDuyet")
			if bTTDuyet then
				bTTDuyet=1
			else
				bTTDuyet=0
			end if
			bNoigui=Request("TxtNoigui")
			bSLNoidung=Request("TxtSLNoidung")
			if KTSoghinhan(bOutnum,bPhanloai,bNam,"okadd") then
				sSQL="Select * from VTQuyetdinh where Phanloai="& bPhanloai &" and year(ngaydi)='"& bNam &"' order by so"
				'sSQL="Select * from VTQuyetdinh where year(ngaydi)='"& bNam &"'  order by so"
				Set RecTD=server.createobject("ADODB.Recordset")
				RecTD.cursorType=3
				RecTD.Cachesize=5
				RecTD.open sSQL,Conn
				if (not RecTD.EOF) and (not RecTD.BOF) then
					RecTD.MOvelast
					bOutnum=cstr(clng(RecTD("so"))+1)
				else
					bOutnum="1"
				end if
			end if
			RecTD.close
			Set RecTD=nothing
			bSoghinhan=trim(bOutnum) & "/" & trim(bOutSymbol)
			Temp=bSoghinhan
			bID="QD"+cstr(year(bNgayky))+"_"+cstr(bPhanloai)+"_"+cstr(bOutnum)
			bTentep=bID+".VT"
			bNguoiduyet=Session("bMaCB")
			bNgayky=SaveDate(bNgayky)
			bNgaydi=SaveDate(bNgaydi)
			'Msg="N&#7897;i dung c&#7853;p nh&#7853;t"
			bTonTai=false
			bComm="edit"				
			bNamCu=bnam
			bPhanloaicu=bPhanloai
			bNhomCVcu=bNhomCV
			bOutnumcu=bOutnum
			if not bTonTai then				
				'Tao Transaction
				On Error resume next
				Conn.BeginTrans			
				'Loc so tu dong theo nam + Phan loai					
				sSQL="Insert Into VTQuyetdinh(ID,so,soghinhan,tomtat,trichyeu,tinhchat,tinhchat1,soto,soban,phanloai,tentep,nguoiky,ngaydi,ngayky,diachiluutru,nguoinhan,tukhoa,congcong,trangthaiduyet,nguoiduyet,loai,soluongnoidung,DVSoan,noinhan,baocao) values('"& modistring(bID) &"',"& bOutnum &",'"& modistring(bSoghinhan) _
						&"','"& ModiString(trim(bTomtat)) &"','"& ModiString(bTrichyeu) &"','"& ModiString(bTinhchat) &"','"& ModiString(bTinhchat1) _
						&"','"& ModiString(bSoto) &"','"& ModiString(bSoban) &"',"& bPhanloai _
						&",'"& ModiString(bTentep) &"','"& ModiString(trim(bNguoiky)) _
						&"','"& bNgaydi &"','"& bNgayky &"',"& bDiachiluutru  _						
						&",'"& ModiString(bNguoinhan) _
						&"','"& ModiString(bTukhoa) &"',"& ModiString(bReadwrite) _
						&","& bTTDuyet &",'"& bNguoiduyet &"','5','"& bSLNoidung &"','"& bSelect1 &"','"& bSelect2 &"','"& bBaocao &"')"					
				Conn.Execute sSQL
				%><%=Err.Description%><%
				bSoghinhancu=bSoghinhan
				bIDcu=bID
				
				'******************
				if bDangky="ok" then
					set Obj=server.CreateObject("ActiveFile.File")
					IDFlow=Request("IDFLow")
					sSQL="Select Tentepxuly from workflow where maworkflow like '"& IDFlow &"'"
					Set RecTT=server.CreateObject("ADODB.Recordset")
					RecTT.CursorType=3
					RecTT.CacheSize=5
					RecTT.Open sSQL,Conn
					if RecTT.RecordCount then
						tentep=RecTT("Tentepxuly")
					end if
					RecTT.Close
					Set RecTT=nothing
					Path1=RootContent & "Data\yeucau\TEXT"  & "\"& IDFlow & ".VT"
					obj.Name=Path1
					fname=bID & ".VT"
					'Tao thu muc nam moi
					Set bDir=server.CreateObject("ActiveFile.Directory")
					bPathFolder=RootContent & "Upload"& "\" & bNam
				
					bDir.Path=bPathFolder
					if not bDir.Exists() then
						call bDir.Create(bPathFolder)
					end if    				
					bPathFolder=bPathFolder & "\Quyetdinh"
					bDir.Path=bPathFolder
					if not bDir.Exists() then
						Call bDir.Create(bPathFolder)
					end if
					
					bPathFolder=bPathFolder & "\Text"
					bDir.Path=bPathFolder
					if not bDir.Exists() then
						Call bDir.Create(bPathFolder)
					end if
					Set bDir=nothing
					if obj.Exists() then
						obj.Name=RootContent & "upload\"& bNam &"\Quyetdinh\TEXT\"& fname
						if obj.Exists() then
							obj.Delete()
						end if

						Obj.Name=Path1												
						Path2=RootContent & "upload\"& bNam &"\Quyetdinh\TEXT\"& fname						
						Obj.Copy(Path2)
						bTentep=fname
						
					else
						loi=true
					end if									
					Set TextFile=server.CreateObject("Vinalines.ClsFile")
					bTEXT=TextFile.ReadTextFile(path1)
					sSQL="Select Tentep,mota from workflow_tentep where maworkflow like '"& IDFlow &"'"					
					Set RecWF=server.CreateObject("ADODB.Recordset")
					RecWF.CursorType=3
					RecWF.CacheSize=5
					RecWF.Open sSQL,Conn	
					if RecWF.RecordCount then
						STT=0
						Do while not RecWF.EOF
							STT=STT+1
							Tentep=bID & "S" & cstr(STT) & "." & TextFile.GetExtensionFile(RecWF("Tentep"))
							P1=RootContent & "Data\yeucau" & "\" & RecWF("Tentep")
							Obj.Name=P1						
							if Obj.Exists() then
								P2=RootContent & "upload\"& bNam &"\Quyetdinh\"& Tentep
								Obj.Copy(P2)
							end if
							sSQL="Insert into vanban_Noidung(Mavanthu,Loaivanthu,SoThutu,tentep,mota) values('"& bID &"','5',"& cstr(STT) &",'"& tentep &"','"& RecWF("mota") &"')"
							Conn.Execute sSQL							
							RecWF.MoveNext
						Loop
					end if
					RecWF.Close
					Set RecWF=nothing
					Set TextFile=nothing
					set Obj=nothing
				end if
		'*****************
				'Ket Thuc Transaction
				if Err.number=0 then
					if Session("VanBan")="" then 
						Session("VanBan")="-" & Session("VanBan") & modistring(bID) & "-"
					else
						Session("VanBan")=Session("VanBan") & modistring(bID) & "-"
					end if
					Session("sSQLQD")=""
					Conn.CommitTrans
					bTrangthai=1
				else
					Conn.RollbackTrans
					bTrangthai=0
				end if
				'Ghi nhan Ai da login thanh cong				
				bHoten=Session("bHoten")
				bNgaygio=cstr(Date()) &" "& cstr(Time())
				bChucnang="C&#7853;p nh&#7853;t V&#259;n th&#432; quyết định"
				bIDTailieu=bSoghinhan
				bDongtac="Th&#234;m m&#7899;i"
				sSQL="insert into loguser(Tennguoisudung,ngaygio,chucnangdung,dongtac,IDTailieu,Trangthai) Values('"& bHoten _
					&"','"& bNgaygio &"','"& bChucnang &"','"& bDongtac &"','"& bIDTailieu &"','"& bTrangthai &"')"
				Conn.Execute sSQL	
				
				Session("bMaVBQD")=bID
				Session("bTenVBQD")=bTrichyeu
			end if
	end select
	if bComm=""  then
		bVuviec=false
	else
		bVuviec=true
	end if
	'Kiem tra(Lay quyen va ma van thu) quyen doi voi van thu
	if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" or Session("IsAdmin") then 
		bQuyen="F"
	else
		sSQL="Select * from Quyen Where Mavanthu like '"& bID &"' and Macanbo like '"& Session("bMaCB") &"' and maloaivanthu like '5'"
		Set RecKTQ=server.CreateObject("ADODB.Recordset")
		RecKTQ.CursorType=3
		RecKTQ.CacheSize=5
		RecKTQ.Open sSQL,Conn
		if RecKTQ.RecordCount>0 then
			bQuyen=RecKTQ("Quyen")
		end if
		RecKTQ.Close
		set RecKTQ=nothing		
	end if%>	
<%if Msg<>"" then%>
	<p align=center><font face=Arial color=red><%=Msg%></font></p>
<%end if%>	
<!--#include file="..\jvfunction.inc"-->
<script language=vbscript runat=server>
'******Giai ma xau************************
	Function GiaiMa(msText) 
	    Dim nC
	    Dim nD
	    Dim nE
	    Dim lA
	    Dim lB
	    Dim lI
	    Dim lJ
	    Dim lK
	    Dim sB
	    lA = Len(msText)
	    lB = lA - 1 - (lA - 1) \ 4
	    sB = Space(lB)
	    For lI = 1 To lB
	        lJ = lJ + 1
	        nC = Asc(Mid(msText, lJ, 1)) - 59	        
	        Select Case lI Mod 3
	        Case 1
	            lK = lK + 4
	            If lK > lA Then lK = lA
	            nE = Asc(Mid(msText, lK, 1)) - 59
	            nD = ((nE \ 16) And 3) * 64
	        Case 2
	            nD = ((nE \ 4) And 3) * 64
	        Case 0
	            nD = (nE And 3) * 64
	            lJ = lJ + 1
	        End Select
	        sB=Mid(sB,1,lI-1) & Chr(nC Or nD) & Mid(sB,lI+1,len(sB)-lI)
	    Next
	    GiaiMa = sB
	End Function
	Function SaveDate(vDate)
		dim bvitri1
		dim bvitri2
	   vDate=trim(cstr(vDate))
	   bvitri1=instr(1,vDate,"/")
	   bMonth=left(vDate,bvitri1-1)
	   bvitri2=instr(bvitri1+1,vDate,"/")
	   Dim Temp
	   Temp=right(vDate,len(vDate)-bvitri1)
	   bDay=left(Temp,bvitri2-bvitri1-1)
	   bYear=right(vDate,len(vDate)-bvitri2)
       SaveDate=bDay+"/"+bMonth+"/"+bYear
	End Function
'Chuyen doi ma
Function DoiMa(st)
    Dim i
    st = Trim(st)
    If Len(st) = 0 Then
        DoiMa = ""
    Else
        For i = 1 To Len(st)
            Select Case Mid(st, i, 1)
                Case "-"
                    st=Replace(st,"-","_")
                Case "+"
                    st=Replace(st,"+","_")
                Case "*"
                    st=Replace(st,"*","_")
                Case "\"            
                    st=Replace(st,"\","_")
                Case "/"
                    st=Replace(st,"/","_")
                Case "?"
                    st=Replace(st,"?","_")
                Case "!"
                    st=Replace(st,"!","_")
                Case ","
                    st=Replace(st,",","_")
                Case ":"
                    st=Replace(st,":","_")
                Case ";"
                    st=Replace(st,";","_")
                Case "^"
                    st=Replace(st,"^","_")
                Case "|"
                    st=Replace(st,"|","_")
                Case " "
                    st=Replace(st," ","_")
                Case "("
                    st=Replace(st,"(","_")
                Case ")"
                    st=Replace(st,")","_")
                Case "["
                    st=Replace(st,"[","_")
                Case "]"
                    st=Replace(st,"]","_")
                Case "{"
                    st=Replace(st,"{","_")
                Case "}"
                    st=Replace(st,"}","_")
                Case "<"
                    st=Replace(st,"<","_")
                Case ">"
                    st=Replace(st,">","_")
                Case "."
                    st=Replace(st,".","_")
            End Select
        Next
        DoiMa = st
    End If
End Function

	' H&#224;m &#273;&#7883;nh d&#7841;ng l&#7841;i ng&#224;y M/D/Y-> D/M/Y		
	Function FormatDate(vDate)
	   If Not IsNull(vDate) Then
	        vM = Right("0" & Month(vDate), 2)
	        vD = Right("0" & Day(vDate), 2)
	        vY = Right("19" & Year(vDate), 4)
	        FormatDate = vD & "/" & vM & "/" & vY
	   End If
	End Function
	Function ModiString(mess_s)
		message = Replace("" & mess_s,"'", "''")
		ModiString=message
	End function
	'Kiem tra so ghi nhan
	Function KTSoghinhan(bValueO,bLoaiVB,bValueY,loai)
		KTSoghinhan=false
		if loai="okedit" then			
				sSQL="Select * from VtQuyetdinh where phanloai="& bLoaiVB &" and so= "& bValueO &" and year(ngaydi)="& bValueY
				set RecKT=server.CreateObject("ADODB.Recordset")
				RecKT.CursorType=3
				RecKT.CacheSize=5
				RecKT.Open sSQL,Conn
				if (not RecKT.BOF) and (not RecKT.EOF) then
					KTSoghinhan=true
				end if
				RecKT.Close
				set RecKT=nothing				
		end if
		if loai="okadd" then
			sSQL="Select ID from vtQuyetdinh where phanloai="& bLoaiVB &" and so= "& bValueO &" and year(ngaydi)="& bValueY
			set RecKT=server.CreateObject("ADODB.Recordset")
			RecKT.CursorType=3
			RecKT.CacheSize=5
			RecKT.Open sSQL,Conn
			if (not RecKT.BOF) and (not RecKT.EOF) then
				KTSoghinhan=true
			end if
			RecKT.Close
			set RecKT=nothing				
		end if			
	end function
	
</script>	
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function CmdDuyet_onclick() {
	<%if bComm="add" then %>
		alert("Bạn cần phải ghi nhận công văn trước");
		return false;
	<%end if%>
	if (!Noidung.CheckReadwrite.Checked){
	<%if bReadwrite then %>
		alert("Bạn cần phải ghi nhận công văn trước");
		return false;
	<%end if%>
	}
	mavt=window.Noidung.TxtID.value;
	window.Noidung.target="right";
	bduyet="duyetcanbo.asp?bDangky="+"<%=bDangky%>"+"&Backform="+"<%=backform%>"+"&bstepduyet=0&bCommDuyetCB="+'<%=bComm%>'+"&MaVT="+mavt+"&bMaLoaiVT=5";
	window.Noidung.action=bduyet
	window.Noidung.submit();
}

function CmdAdd_onclick() {
	<%if bDangky="ok" then%>
		window.Noidung.action="frmvtQuyetdinh.asp?FilenameChuyen="+"<%=request("Filenamechuyen")%>"+"&bDangky="+"<%=bDangky%>"+"&Backform="+"<%=backform%>"+"&bComm=add";
	<%else%>
		window.Noidung.action="frmvtQuyetdinh.asp?bComm=add";
	<%end if%>	
	window.Noidung.target="right";
	window.Noidung.submit();
}
function KTNhap(){
	if(trim(Noidung.TxtOutSymbol.value)==""){
		alert("Bạn cần phải nhập ký hiệu");
		Noidung.TxtOutSymbol.focus();
		return false;
	}
	if (trim(Noidung.TxtTrichyeu.value)==""){
		alert("Bạn cần phải nhập trích yếu");
		Noidung.TxtTrichyeu.focus();
		return false;
	}
	if (trim(Noidung.TxtNgayky.value)==""){
		alert("Cho biết ngày ký");
		Noidung.TxtNgayky.focus();
		return false;
	}	
	if (!isDate(Noidung.TxtNgayky.value)){
		alert("Ngày ký không hợp lệ");
		Noidung.TxtNgayky.focus();
		return false;
	}
	if (trim(Noidung.TxtNguoiky.value)==""){
		alert("Cho biết người ký");
		Noidung.TxtNguoiky.focus();
		return false;
	}
	if (trim(Noidung.ComboTinhchat.value)==""){
		alert("Cho biết tính chất");
		Noidung.ComboTinhchat.focus();
		return false;
	}
	return true;
}

function CmdOK_onclick() {	
	if (KTNhap()){
		if(trim(Noidung.TxtNgayky.value)!=""){	
			if (!isDate(Noidung.TxtNgayky.value)){
				alert("Ngày ký không hợp lệ");
				Noidung.TxtNgayky.focus();
				return false;
			}
		}
		<% if Request("ChuyenVTQD")="ok" then%>
		Noidung.ComboPhanloai.value=Noidung.PL.value;
		<%end if%>
		Noidung.TxtOutNum.disabled=false;
		Noidung.TxtOutSymbol.disabled=false;
		<%if bComm="edit" then%>
			window.Noidung.target="right"
			window.Noidung.action="frmvtQuyetdinh.asp?bSoghinhancu="+"<%=bSoghinhancu%>"+"&bDangky="+"<%=bDangky%>"+"&Backform="+"<%=backform%>"+"&bComm=okedit&bIDcu="+"<%=bIDcu%>"+"&bOutnumcu="+"<%=bOutnumcu%>"+"&bNhomCVcu="+"<%=bNhomCVcu%>"+"&bPhanloaicu="+"<%=bPhanloaicu%>"+"&bNamcu="+"<%=bNamcu%>"+"&bReadwrite="+Noidung.CheckReadwrite.checked+"&bTTDuyet="+ "<%=bTTDuyet%>"
		window.Noidung.submit()
		<%end if%>
		<%if bComm="add" then%>			
			window.Noidung.target="right"
			window.Noidung.action="frmvtQuyetdinh.asp?bDangky="+"<%=bDangky%>"+"&Backform="+"<%=backform%>"+"&IDFlow="+"<%=request("IDFLow")%>"+"&bComm=okadd"+"&bReadwrite="+Noidung.CheckReadwrite.checked+"&bTTDuyet=false"
			window.Noidung.submit()
		<%end if%>
	}
}
function CmdOKDuyet_onclick(){
		Noidung.TxtOutNum.disabled=false;
		<%if bComm="add" then %>
			alert("Bạn cần phải ghi nhận công văn trước");
			return false;
		<%end if%>
		if (KTNhap()){
		if(Noidung.TxtNgayky.value!=""){	
			if (!isDate(Noidung.TxtNgayky.value)){
				alert("Ngày ký không hợp lệ");
				Noidung.TxtNgayky.focus();
				return false;
			}
		}
		Noidung.TxtOutSymbol.disabled=false;
		<%if bComm="edit" then%>
			window.Noidung.target="right"
window.Noidung.action="frmvtQuyetdinh.asp?bSoghinhancu="+"<%=bSoghinhancu%>"+"&bDangky="+"<%=bDangky%>"+"&Backform="+"<%=backform%>"+"&bComm=okedit&bIDcu="+"<%=bIDcu%>"+"&bPhanloaicu="+"<%=bPhanloaicu%>"+"&bNamcu="+"<%=bNamcu%>"+"&bNhomCVcu="+"<%=bNhomCVcu%>"+"&bOutnumcu="+"<%=bOutnumcu%>"+"&bReadwrite="+Noidung.CheckReadwrite.checked+"&bTTDuyet=True"

		window.Noidung.submit()
		<%end if%>
	}
}
function CmdNotOKDuyet_onclick(){
	
	<%if bComm="add" then %>
		alert("Bạn cần phải ghi nhận công văn trước");
		return false;
	<%end if%>
		if (KTNhap()){
		if(trim(Noidung.TxtNgayky.value)!=""){	
			if (!isDate(Noidung.TxtNgayky.value)){
				alert("Ngày ký không hợp lệ");
				Noidung.TxtNgayky.focus();
				return false;
			}
		}
		Noidung.TxtOutSymbol.disabled=false;
		Noidung.TxtOutNum.disabled=false;
		<%if bComm="edit" then%>
			Noidung.target="right"
			Noidung.action="frmvtQuyetdinh.asp?bSoghinhancu="+"<%=bSoghinhancu%>"+"&bDangky="+"<%=bDangky%>"+"&Backform="+"<%=backform%>"+"&bComm=okedit&bIDcu="+"<%=bIDcu%>"+"&bPhanloaicu="+"<%=bPhanloaicu%>"+"&bNamcu="+"<%=bNamcu%>"+"&bNhomCVcu="+"<%=bNhomCVcu%>"+"&bOutnumcu="+"<%=bOutnumcu%>"+"&bReadwrite="+Noidung.CheckReadwrite.checked+"&bTTDuyet=false"
		Noidung.submit()
		<%end if%>
	}
}
function CmdExit_onclick() {	
	<%if Request("bDangky")="ok" then%>
		window.history.go(-<%=Backform%>);
	<%else%>
		Noidung.target="right"
		//Noidung.action="frmdsvtQuyetdinh.asp?bComm=search&bBack=ok";
		Noidung.action="frmdsvtQuyetdinh.asp?bComm=";
		Noidung.submit();
	<%end if%>
}

function CmdCancel_onclick() {
	Noidung.CmdOK.disabled=true;
	Noidung.CmdCancel.disabled=true;
}
function CmdXacnhan_onclick() {
	if(Noidung.TxtPsw.value=="<%=Giaima(Session("Pass"))%>"){
		if(Noidung.CheckDuyet.disabled){
			Noidung.CheckDuyet.disabled=false;
			Noidung.CmdNoidungtep.disabled=false;
		}
		else{
			Noidung.CheckDuyet.disabled=true;
			Noidung.CmdNoidungtep.disabled=true;
		}
		return true
	}
	else{
		alert("B&#7841;n x&#225;c nh&#7853;n sai m&#7853;t kh&#7849;u !")
		return false;
	}
	Noidung.TxtPsw.value="";
}
function CheckReadwrite_onclick(){
	if (Noidung.CheckReadwrite.checked){
		Noidung.CmdDuyet.disabled=true;
		CmdOK_onclick();
	}		
	else{
		Noidung.CmdDuyet.disabled=false;
		CmdOK_onclick();
	}
}

function CmdXemNoidung_onclick(){	
	<%if bComm="add" then %>
		alert("Bạn cần phải ghi nhận công văn trước");
		return false;
	<%end if%>	
	if (Noidung.TxtID.value!=""){
		window.Noidung.target="_blank";
		bMa=Noidung.TxtID.value;
		window.Noidung.action="xemnoidung.asp?LoaiVt=5&bMa="+bMa+"&bNam="+"<%=bNam%>"
		window.Noidung.submit();
	}
}
function CmdNoidungtep_onclick() {	
	<%if bComm="add" then %>
		alert("Bạn cần phải ghi nhận công văn trước");
		return false;
	<%end if%>	
	<%if bQuyen="" or bQuyen="R" then%>
		alert("B&#7841;n kh&#244;ng c&#243; quy&#7873;n s&#7917;a &#273;&#7893;i n&#7897;i dung v&#259;n th&#432;");
		return false;
	<%end if%>
	<% if bComm="edit" then%>
		bMa=Noidung.TxtID.value;
		a="../editor/frmedit.asp?bMa="+bMa+"&bLoaiVT=5&bNam="+"<%=bNam%>"+"&bNamcu="+"<%=bNamCu%>";
		window.Noidung.action=a;
		window.Noidung.target="right";
		window.Noidung.submit();
	<%end if%>		
}
function cmddangkyvv_onclick() {
	<%if bComm="add" then %>
		alert("Bạn cần phải ghi nhận công văn trước");
		return false;
	<%end if%>
	<%if bVuviec then%>
		window.Noidung.target="main";
		window.Noidung.action="dangkyvuviec/frmdangky.asp?LoaiVt=5";
		window.Noidung.submit();
	<%else%>
		alert("B&#7841;n c&#7847;n ph&#7843;i ch&#7885;n v&#259;n th&#432; &#273;&#7875; &#273;&#259;ng k&#253;");
	<%end if%>
}
function CmdThemVV_onclick() {
	<%if bComm="add" then %>
		alert("Bạn cần phải ghi nhận công văn trước");
		return false;
	<%end if%>
	<%if bVuviec then%>
		window.Noidung.target="right"
		window.Noidung.action="frmvuviec.asp?bcallfrmvtden=ok&bTrichyeuvtden="+Noidung.TxtTrichyeu.value;
		window.Noidung.submit();
	<%else%>
		alert("B&#7841;n c&#7847;n ph&#7843;i ch&#7885;n m&#7897;t v&#259;n th&#432; l&#224;m vi&#7879;c");
	<%end if%>
}

function CmdNext_onclick() {
	if(Noidung.TxtTTNoidung.value<Noidung.TxtSLNoidung.value){
		Noidung.TxtTTNoidung.value=++Noidung.TxtTTNoidung.value;		
	}
}

function CmdPrv_onclick() {
	if(Noidung.TxtTTNoidung.value>1){
		Noidung.TxtTTNoidung.value=--Noidung.TxtTTNoidung.value;
	}
}
function CmdNext1_onclick() {
	if(Noidung.TxtSLNoidung.value<3){
		Noidung.TxtSLNoidung.value=++Noidung.TxtSLNoidung.value;		
	}
}
function CmdPrv1_onclick() {
	if(Noidung.TxtSLNoidung.value>1){
		Noidung.TxtSLNoidung.value=--Noidung.TxtSLNoidung.value;
		if(Noidung.TxtTTNoidung.value>Noidung.TxtSLNoidung.value){
			Noidung.TxtTTNoidung.value=Noidung.TxtSLNoidung.value;
		}
	}
}
function ComboNguoiky_onchange() {
	Noidung.TxtNguoiky.value=Noidung.ComboNguoiky.value;
}
function ComboNguoinhan_onchange() {
	Noidung.TxtNguoinhan.value=Noidung.ComboNguoinhan.value;
}
function ComboOutSymbol_onchange() {
	Noidung.TxtOutSymbol.value=Noidung.ComboOutSymbol.value;
}
function CmdNoinhan_onclick() {
	if (Noidung.CmdNoinhan.value!="Ghi nhận nơi nhận công văn"){
		Noidung.select2.style.visibility="visible";		
		Noidung.CmdNoinhan.value="Ghi nhận nơi nhận công văn";
		Noidung.CmdDonvi.value="Đơn vị soạn";
		Noidung.select1.style.visibility="hidden";		
	}
	else{
		Noidung.select2.style.visibility="hidden";		
		Noidung.CmdNoinhan.value="Nơi nhận";

		Noidung.CmdDonvi.value="Đơn vị soạn";	
		Noidung.select1.style.visibility="hidden";				
	}
}
function CmdDonvi_onclick() {
	if (Noidung.CmdDonvi.value!="Ghi nhận đơn vị soạn"){
		Noidung.select2.style.visibility="hidden";
		Noidung.CmdNoinhan.value="Nơi nhận";
		
		Noidung.CmdDonvi.value="Ghi nhận đơn vị soạn";
		Noidung.select1.style.visibility="visible";				
	}
	else{
		Noidung.select1.style.visibility="hidden";		
		Noidung.CmdDonvi.value="Đơn vị soạn";
		
		Noidung.CmdNoinhan.value="Nơi nhận";
		Noidung.select2.style.visibility="hidden";				
	}
}
function openNN(sObj) {
  popupWin = window.open('Search.asp?bType=QD','new_page','width=300,height=300').focus();
}
function openDV(sObj) {
  popupWin = window.open('AddDV.asp?bType=QD','new_page','width=300,height=300').focus();
}
function CmdEmail_onclick() {
	Noidung.target="_blank";
	bMa=Noidung.TxtID.value;
	Noidung.action="compose.asp?bLoaiVt=5&bMa="+bMa+"&bNam="+"<%=bNam%>";
	Noidung.submit();
}

function TxtNgayky_onkeyup(str){
var keycode
keycode=window.event.keyCode
if (isEdit(keycode,str)){
	Noidung.TxtNgayky.value=editdate(trim(str))
}
}

function TxtNgaydi_onkeyup(str){
var keycode
keycode=window.event.keyCode
if (isEdit(keycode,str)){
	Noidung.TxtNgaydi.value=editdate(trim(str))
}
}

function CmdLuong_onclick()
{
	if (Noidung.TxtOutNum.value=="" || Noidung.TxtOutSymbol.value==""){
		alert("Bạn hãy chọn quyết định cần xử lý");
		return false;
	}
	if(!confirm("Bạn có muốn tạo luồng xử lý không ?")){
	  return false;
	}
	window.Noidung.target="right";
	window.Noidung.action="../workflow/createworkflow.asp?bComm=vtquyetdinh";
	window.Noidung.submit();
}
//-->
</SCRIPT>
<body bgcolor="#F8F9D9" topmargin="0" leftmargin="0" style="font-family:times new roman">
<Form name="Noidung" Method="Post" >
<input type=hidden name=chuyendi value="<%=trim(chuyendi)%>">
<input type=hidden name=ComboPhanloai value="<%=bPhanloai%>">
<%if bDisplay then
	txt="<td width='200' align='left'><input type=hidden name='TxtID' size='50' value='"& bID &"' style='font-family:Arial'></td>"
	Response.Write(txt)
else
	if bComm<>"add" then
		txt="<td width='200' align='left'><input type=hidden name='TxtID' value='"& bID &"' size='50' style='font-family:Arial'></td>"
		Response.Write(txt)
	else
		txt="<td width='200' align='left'><input type=hidden name='TxtID' value='"& AutoSoghinhan &"'size='50' style='font-family:Arial'></td>"
		Response.Write(txt)
	end if
end if%>
<!-- Form nhap lieu -->
<table border="0" cellspacing="0" style="font-size:11pt;BORDER-BOTTOM-STYLE: none; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid;border-collapse:collapse; border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0" width="100%" bordercolor="#111111" bgcolor="#BDD5D0">
  <tr>
    <td width="100%" colspan="5" height="14" bgcolor="#000080">
    <p align="center"><font color="#FFFFFF"><span style="font-size: 11pt">CÔNG VĂN QUYẾT ĐỊNH</span></font></td>
  </tr>
  <tr>
    <td width="15%">Ngày đi</td>
	<td width="85%" colspan="4">
    <%if bDisplay then%>
			<input name=TxtNgaydi value="<%= formatdate(bNgaydi) %>" maxLength=10 size=8  style='font-family:Arial' LANGUAGE=javascript onkeyup="return TxtNgaydi_onkeyup(this.value)">    
			Số, Ký hiệu
			<input name='TxtOutNum' value='<%= bOutNum %>' size=8  maxLength=20 style='font-family:Arial'>/
			<input name=TxtOutSymbol size=20 value='<%=bOutSymbol %>' style="font-family:'Times new roman'">			
	<%else
		if bComm<>"add" then%>
				<input name=TxtNgaydi value="<%= formatdate(bNgaydi) %>" maxLength=10 size=8  style='font-family:Arial' LANGUAGE=javascript onkeyup="return TxtNgaydi_onkeyup(this.value)">
				Số, Ký hiệu
				<input name='TxtOutNum' value='<%= bOutNum %>' size=8  maxLength=20 style='font-family:Arial'>/
				<input name=TxtOutSymbol size=20 value='<%=bOutSymbol %>' style="font-family:'Times new roman'">	
		<%else%>
				<input name=TxtNgaydi value="<%= formatdate(date()) %>" maxLength=10 size=8 style='font-family:Arial' LANGUAGE=javascript onkeyup="return TxtNgaydi_onkeyup(this.value)">
				Số, Ký hiệu
				<%	
				Set RecMax=Server.createObject("ADODB.Recordset")
				RecMax.CursorType=3
				RecMax.CacheSize=5
				sSQL="Select * from VTQuyetdinh where Phanloai="& bPhanloai &" and year(ngaydi)=year(getdate()) order by so"
				RecMax.Open sSQL,Conn
				if RecMax.recordcount then
					RecMax.movelast
					AutoSoghinhan =cstr(cint(RecMax("so"))+1)
				else
					AutoSoghinhan ="1"
				end if
				RecMax.close
				set RecMax=nothing
				
				Set RecMax=Server.createObject("ADODB.Recordset")
				RecMax.CursorType=3
				RecMax.CacheSize=5
				sSQL="Select * from Phan_loai_QD where IDLoai="& bPhanloai
				RecMax.Open sSQL,Conn
				if RecMax.recordcount then
					bTenHT=RecMax("Ma_ky_hieu")
				end if
				RecMax.close
				set RecMax=nothing
				%>
				<input name='TxtOutNum' value="<%=AutoSoghinhan%>" size=8 maxLength=10 style='font-family:Arial'>/
				<input name=TxtOutSymbol value="<%=trim(bTenHT)%>" size=20 style="font-family:Times new roman">
		<%end if		
	end if%>	   
		</td>  
  </tr>
  <tr>
    <td width="15%">Trích yếu</td>
	<td width="85%" colspan="4">
    <%if bDisplay then%>
		<textarea name=TxtTrichyeu maxLength=255 style='font-family:Arial;width:100%' rows=1 cols="82"><%= bTrichyeu %></textarea></td>
	<%else
		if bComm<>"add" then%>
			<textarea name=TxtTrichyeu maxLength=255 style='font-family:Arial;width:100%' cols=82 rows=1><%= bTrichyeu %></textarea></td>
		<%else
			if Request("ChuyenVTQD")="ok" then
				Set RecTY=server.CreateObject("ADODB.Recordset")
				RecTY.CursorType=3
				RecTY.CacheSize=5
				sSQL="Select Tenvuviec from workflow where Maworkflow like '"& Request("IDFlow") &"'"
				RecTY.Open sSQL,Conn
				if RecTY.RecordCount then
					if trim(RecTY("Tenvuviec"))<>"" then%>
						<textarea name=TxtTrichyeu maxLength=255 style='font-family:Arial;width:100%' cols=82 rows=1><%= RecTY("Tenvuviec")%></textarea></td>
					<%else%> 
						<textarea name=TxtTrichyeu  maxLength=255 style='font-family:Arial;width:100%' rows=1 cols=82></textarea></td>
					<%end if%>
				<%else%>
					<textarea name=TxtTrichyeu  maxLength=255 style='font-family:Arial;width:100%' rows=1 cols=82></textarea></td>
				<%end if
				RecTY.Close
				set RecTY=nothing
			else%>
				<textarea name=TxtTrichyeu maxLength=255 style='font-family:Arial;width:100%' rows=1 cols=82><%= request("bSubject") %></textarea></td>
			<%end if
		end if
	end if%>
  </tr>
  <tr>
    <td width="15%">Tóm tắt ND</td>
	<td width="85%" colspan="4">
    <%if bDisplay then%>
        <Textarea name=TxtTomtat maxlength=500  style='font-family:Arial;width:100%' rows="2" cols="20"><%=trim(bTomtat)%></textarea></td>
	<%else
		if bComm<>"add" then%>
            <Textarea name=TxtTomtat maxlength=500  style='font-family:Arial;width:100%' rows="2"><%=trim(bTomtat)%></textarea></td>
		<%else%>
            <Textarea name=TxtTomtat maxlength=500 style='font-family:Arial;width:100%' rows="2"></textarea></td>
		<%end if
	end if%>
  </tr>

  <tr>
    <td width="15%" >Ngày ký</td>
	<td width="20%">
    <%if bDisplay then%>
		<input name=TxtNgayky value='<%= formatdate(bNgayky) %>' size=8 maxLength=10 style='font-family:Arial;width:100%' LANGUAGE=javascript onkeyup="return TxtNgayky_onkeyup(this.value)"></td>
	<%else
		if bComm<>"add" then%>
			<input name=TxtNgayky value='<%= formatdate(bNgayky) %>' size=8 maxLength=10 style='font-family:Arial;width:100%' LANGUAGE=javascript onkeyup="return TxtNgayky_onkeyup(this.value)"></td>
		<%else%>
			<input name=TxtNgayky value="<%= FormatDate(Date) %>" size=8 maxLength=10 style='font-family:Arial;width:100%' LANGUAGE=javascript onkeyup="return TxtNgayky_onkeyup(this.value)"></td>
		<%end if
	end if%>    
<td width="15%" align="center">Người ký</td>
	<td width="25%">
    <%if bDisplay then%>
			<input type= "text" name=TxtNguoiky size=20 value='<%= trim(bNguoiky) %>' maxLength=60 style='font-family:Arial'></td>
		<%else
			if bComm<>"add" then%>
				<input type= "text" name=TxtNguoiky size=20 value='<%= trim(bNguoiky) %>' maxLength=60 style='font-family:Arial'></td>
			<%else%>
				<input type= "text" name=TxtNguoiky size=20 maxLength=60 style='font-family:Arial'></td>
			<%end if
	  end if
		sSQL="Select Hovaten from Canbo order by Hovaten"
		Set RecNK=server.CreateObject("ADODB.Recordset")
		RecNK.CursorType=3
		RecNK.CacheSize=5
		RecNK.Open sSQL,Conn%>
		<td width="25%"><select size=1 name=ComboNguoiky style='font-family: Arial;width:100%' LANGUAGE=javascript onchange='return ComboNguoiky_onchange()' cols=25>
			<option value='' selected>
			<%Do While not RecNK.EOF%>
			<option value='<%=RecNK("Hovaten")%>'><%=RecNK("Hovaten")%>
			<%RecNK.MoveNext
			Loop
			txt="</select>"
			Response.Write(txt)
			RecNK.Close
			Set RecNK=nothing
		%>        
	    </select></td>	
	</tr>
    <tr>
    <td width="15%">Khẩn/mật</td>
    <td width="35%" colspan=2>		
    <select size="1" name="ComboTinhchat" style="font-family: times new roman; height: 23; position: relative; width: 100%">
		<%
			sSQL="Select * from Tinhchat"
			Set RecTC=Server.CreateObject("ADODB.Recordset")
			RecTC.CursorType=3
			RecTC.CacheSize=5
			RecTC.Open sSQL,Conn
			Do While not RecTC.EOF
				if bDisplay then
					if RecTC("ma")=bTinhchat then		
		%>				<option Selected value=<%=RecTC("Ma")%>><%=RecTC("Ten")%>
		<%			else%>
						<option value=<%=RecTC("Ma")%>><%=RecTC("Ten")%>
		<%			end if
				else%>
					<%if bComm<>"add" then
						if RecTC("ma")=bTinhchat then		
		%>					<option Selected value=<%=RecTC("Ma")%>><%=RecTC("Ten")%>
		<%				else%>
							<option value=<%=RecTC("Ma")%>><%=RecTC("Ten")%>
		<%				end if
					else%>
						<option value=<%=RecTC("Ma")%>><%=RecTC("Ten")%>
					<%end if%>
		<%		end if
				RecTC.MoveNext
			Loop
			RecTC.Close
			set RecTC=nothing
		%>
		</select>
	</td>
    <td width="50%" colspan=2>
	 <%if bDisplay then%>
		 	Số bản <input name=TxtSoban value="<%=bSoban%>" style="font-family:times new roman" size=2 maxlength=4>
		 	Số tờ <input name=TxtSoto value="<%=bSoto%>" style="font-family:times new roman" size=2 maxlength=4>
	<%else
		if bComm<>"add" then%>
			Số bản <input name=TxtSoban value="<%=bSoban%>" style="font-family:times new roman" size=2 maxlength=4>
		 	Số tờ <input name=TxtSoto value="<%=bSoto%>" style="font-family:times new roman" size=2 maxlength=4>
		<%else%>
			Số bản <input name=TxtSoban style="font-family:times new roman" size=2 maxlength=4>
		 	Số tờ <input name=TxtSoto style="font-family:times new roman" size=2 maxlength=4>
		<%end if
	end if%>    		
		<%if bBaocao or bComm="add" then%>
				<label for=C1 accesskey="V">Điểm <u>v</u>ăn bản</label><input name=ChkBC type=checkbox  checked value="ON" id=C1>
		<%else%>
				<label for=C1 accesskey="V">Điểm <u>v</u>ăn bản</label><input name=ChkBC type=checkbox value="ON" id=C1>
		<%end if%>
    </td>
  </tr>
  <% if Request("ChuyenVTQD")="ok" then%>
	<tr>
    <td width="15%" >Loại VB</td>
    <td width="85%" colspan=4>
    		<%
        sSQL="Select * from Phan_loai_QD"
		Set RecCB=server.CreateObject("ADODB.Recordset")
		RecCB.CursorType=3
		RecCB.CacheSize=5
		RecCB.Open sSQL,Conn%>
		<select size=1 name=PL style='font-family: Arial;width: 100%'>
		<%Do While not RecCB.EOF	%>
				<option value=<%=RecCB("IDLoai")%>><%=RecCB("Ten_hinh_thuc")%>
				<%RecCB.MoveNext
		Loop
		txt="</select>"
		Response.Write(txt)
		RecCB.Close
		Set RecCB=nothing%>         
      </td>
  </tr>
<%end if%>
  <tr>
	<td width="15%"><input type=button onclick="javascript:openDV()" value="Đơn vị soạn" name=CmdDonvi style="font-family:Arial;width:100%; background-color=#BDD5D0"" ></td>
	<td width="85%" colspan="4">
    <input name=select1  maxlength=500 value="<%=bselect1%>" style="font-family:Arial;width:100%" size="20"></td>
  </tr>
  <tr>
	<td width="15%"><input type=button onclick="javascript:openNN()" value="Nơi nhận" name=CmdNoinhan style="font-family:Arial;width:100%; background-color=#BDD5D0""></td>
	<td width="85%" colspan="4">
    <input name=select2 maxlength=500 value="<%=bselect2%>" style="font-family: Arial;width:100%" size="20"></td>
  </tr>
  <%'<tr><td width=100 >Nơi nhận</td>%>
    <%if bDisplay then%>
		<%'<td width=520 colspan=4 ><input  name=TxtNoinhan ' size=82 maxLength=100 style='font-family:Arial;VISIBILITY: hidden; '></td>%>
	<%else
		if bComm<>"add" then%>
			<%'<td width=520 colspan=4 ><input name=TxtNoinhan ' size=82 maxLength=100 style='font-family:Arial;VISIBILITY: hidden; '></td>%>
		<%else%>
			<%'<td width=520 colspan=4 ><input name=TxtNoinhan size=82 maxLength=100 style='font-family:Arial;VISIBILITY: hidden; '></td>%>
		<%end if
	end if%>    
<%'  </tr>%>
<!--	DIA CHI LUU TRU
  <tr>
    <td width="15%">Đ/c lưu trữ</td>
    <td width="85%" colspan="4">
      <p align="center">
      <%
   		sSQL="Select * from Diachiluutru"
		Set RecCB=server.CreateObject("ADODB.Recordset")
		RecCB.CursorType=3
		RecCB.CacheSize=5
		RecCB.Open sSQL,Conn
		Txt="<select size=1 name=TxtDiachiluutru style='font-family: Arial; height: 23; position: relative; width:100%'>"
		Response.Write(txt)%>				
		<%Do While not RecCB.EOF				
				if bDisplay then
					if trim(cstr(RecCB("IDLuutru")))=trim(bDiachiluutru) then		
		%>				<option Selected value=<%=RecCB("IDLuutru")%>><%=RecCB("Ten")%>
		<%			else%>
						<option value=<%=RecCB("IDLuutru")%>><%=RecCB("Ten")%>
		<%			end if
				else%>
					<%if bComm<>"add" then
						if trim(cstr(RecCB("IDLuutru")))=trim(bDiachiluutru) then		
		%>					<option Selected value=<%=RecCB("IDLuutru")%>><%=RecCB("Ten")%>
		<%				else%>
							<option value=<%=RecCB("IDLuutru")%>><%=RecCB("Ten")%>
		<%				end if
					else%>
						<option value=<%=RecCB("IDLuutru")%>><%=RecCB("Ten")%>
					<%end if%>
		<%		end if
				RecCB.MoveNext
		Loop
		txt="</select>"
		Response.Write(txt)
		RecCB.Close
		Set RecCB=nothing%>
	</td>		
  </tr>
-->
  <tr>
    <td width="15%">Từ khóa</td>
	<%if bDisplay then%>
		<td width="35%" colspan="2">
        <input name=TxtTukhoa value='<%= bTukhoa %>' maxLength=100 style='font-family:Arial;width:100%' size="20"></td>
		<td width="50%" colspan=2>
		<%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),5)="1" or Session("IsAdmin") then  %>
			<Button name="CmdOK" style="font-family: Arial;width:32%" LANGUAGE=javascript onclick="CmdEmail_onclick()" accesskey="E"><u>E</u>mail</Button>
		<%else%>
			<Button name="CmdOK" disabled style="font-family: Arial;width:32%" LANGUAGE=javascript onclick="CmdEmail_onclick()" accesskey="E"><u>E</u>mail</Button>
		<%end if%>
		<%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),9)="1" or Session("IsAdmin") then  %>
		<Button  name="CmdLuong" style="font-family: Arial;width: 33%"  LANGUAGE=javascript onclick="return CmdLuong_onclick()" accesskey="A"><p>T<u>ạ</u>o luồng xử lý</p></Button>
		<%else%>
		<Button  name="CmdLuong" disabled style="font-family: Arial;width: 33%"  LANGUAGE=javascript onclick="return CmdLuong_onclick()" accesskey="A"><p>T<u>ạ</u>o luồng xử lý</p></Button>
		<%end if%>
		<Button  name="CmdOK" style="font-family: Arial;width: 32%"  LANGUAGE=javascript onclick="return CmdOK_onclick()" accesskey="G"><p><u>G</u>hi nhận</p></Button></td>
	<%else
		if bComm<>"add" then%>
			<td width="35%" colspan="2">
            <input name=TxtTukhoa value='<%= bTukhoa %>' maxLength=100 style='font-family:Arial;width:100%' size="20">
			<td width="50%" colspan=2>
			<%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),5)="1" or Session("IsAdmin") then  %>
				<Button name="CmdOK" style="font-family: Arial;width:32%" LANGUAGE=javascript onclick="CmdEmail_onclick()" accesskey="E"><u>E</u>mail</Button>
			<%else%>
				<Button name="CmdOK" disabled style="font-family: Arial;width:32%" LANGUAGE=javascript onclick="CmdEmail_onclick()" accesskey="E"><u>E</u>mail</Button>
			<%end if%>
			<%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),9)="1" or Session("IsAdmin") then  %>
				<Button name="CmdLuong" style="font-family: Arial;width: 33%"  LANGUAGE=javascript onclick="return CmdLuong_onclick()" accesskey="A"><p>T<u>ạ</u>o luồng xử lý</p></Button>
			<%else%>
				<Button name="CmdLuong" disabled style="font-family: Arial;width: 33%"  LANGUAGE=javascript onclick="return CmdLuong_onclick()" accesskey="A"><p>T<u>ạ</u>o luồng xử lý</p></Button>
			<%end if%>
			<Button name="CmdOK" style="font-family: Arial;width:32%"  LANGUAGE=javascript onclick="return CmdOK_onclick()" accesskey="G"><p><u>G</u>hi nhận</p></Button></td>
		<%else%>
			<td width="35%" colspan="2">
            <input name=TxtTukhoa maxLength=100 style='font-family:Arial;width:100%' size="20">
			<td width="50%" colspan=2>
			<Button name="CmdOK" disabled style="font-family: Arial;width:32%"  LANGUAGE=javascript onclick="CmdEmail_onclick()" accesskey="E"><u>E</u>mail</Button>
			<Button name="CmdLuong" disabled style="font-family: Arial;width: 33%"  LANGUAGE=javascript onclick="return CmdLuong_onclick()" accesskey="A"><p>T<u>ạ</u>o luồng xử lý</p></Button>
			<Button name="CmdOK" style="font-family: Arial;width:32%"  LANGUAGE=javascript onclick="return CmdOK_onclick()" accesskey="G"><p><u>G</u>hi nhận</p></Button></td>
		<%end if
	end if%>    
</tr>
</table>
<!-- Quy dinh quyen, noi dung cong van -->
<table border="0" cellspacing="1" style="font-size:12pt;BORDER-BOTTOM-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid;border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0" width="100%" bgcolor="#BDD5D0" cellpadding="1">
<tr>
	<td width="50%" colspan="2" align="center" bgcolor="#000080">
    <font color="#FFFFFF"><b>Quy định quyền văn bản</b></font></td>
	<td width="25%" align="center" bgcolor="#000080"><font color="#FFFFFF"><b>Nội dung văn bản</b></font></td>
	<td width="25%" align="center" bgcolor="#000080"><font color="#FFFFFF"><b>Chức 
    năng</b></font></td>
</tr>
<tr>
	<td width="25%" align=center><label for=C2 accesskey="C"><u>C</u>ho phép công bố</label>
	<%	
					if bDisplay then
						if  bReadwrite then
							if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" or Session("IsAdmin") then %>
                                <input type=checkbox name=CheckReadwrite Checked language=javascript onclick='return CheckReadwrite_onclick()' value="ON" id=C2></td>
							<%else%>
                                <input type=checkbox name=CheckReadwrite Checked disabled=true  language=javascript onclick='return CheckReadwrite_onclick()' value="ON" id=C2></td>
							<%end if
						else
							if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" or Session("IsAdmin") then %>
                                <input type=checkbox name=CheckReadwrite language=javascript onclick='return CheckReadwrite_onclick()' value="ON" id=C2></td>
							<%else%>
                                <input type=checkbox name=CheckReadwrite disabled=true  language=javascript onclick='return CheckReadwrite_onclick()' value="ON" id=C2></td>
							<%end if
						end if
					else
						if bComm<>"add" then
							if  bReadwrite then
								if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" or Session("IsAdmin") then%>
                                    <input type=checkbox name=CheckReadwrite Checked language=javascript onclick='return CheckReadwrite_onclick()' value="ON" id=C2></td>
								<%else%>
                                    <input type=checkbox name=CheckReadwrite Checked disabled=true  language=javascript onclick='return CheckReadwrite_onclick()' value="ON" id=C2></td>								
								<%end if
							else
								if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" or Session("IsAdmin") then%>
                                    <input type=checkbox name=CheckReadwrite language=javascript onclick='return CheckReadwrite_onclick()' value="ON" id=C2></td>
								<%else%>
                                    <input type=checkbox name=CheckReadwrite disabled=true  language=javascript onclick='return CheckReadwrite_onclick()' value="ON" id=C2></td>
								<%end if
							end if
						else
							if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" or Session("IsAdmin") then%>
                                <input type=checkbox name=CheckReadwrite language=javascript onclick='return CheckReadwrite_onclick()' value="ON" id=C2></td>
							<%else%>
                                <input type=checkbox name=CheckReadwrite disabled=true  language=javascript onclick='return CheckReadwrite_onclick()' value="ON" id=C2></td>
							<%end if			
						end if
					end if
				%>
				<%  if bDisplay then
						if  bReadwrite then%>
							<td width="25%"><Button disabled name='CmdDuyet' style='font-family: Arial;width:100%' LANGUAGE=javascript onclick='return CmdDuyet_onclick()' accesskey="Q"><p><u>Q</u>uy định quyền</p></Button></td>
						<%else
							if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" or Session("IsAdmin") then%>
								<td width="25%"><Button name='CmdDuyet' style='font-family: Arial;width:100%' LANGUAGE=javascript onclick='return CmdDuyet_onclick()'accesskey="Q"><p><u>Q</u>uy định quyền</p></Button></td>
							<%else%>
								<td width="25%"><Button disabled name='CmdDuyet' style='font-family: Arial;width:100%' LANGUAGE=javascript onclick='return CmdDuyet_onclick()'accesskey="Q"><p><u>Q</u>uy định quyền</p></Button></td>
							<%end if
						end if
					else
						if bComm<>"add" then
							if  bReadwrite then%>
								<td width="25%"><Button disabled name='CmdDuyet' style='font-family: Arial;width:100%' LANGUAGE=javascript onclick='return CmdDuyet_onclick()'accesskey="Q"><p><u>Q</u>uy định quyền</p></Button></td>
							<%else
								if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" or Session("IsAdmin") then%>
									<td width="25%"><Button name='CmdDuyet' style='font-family: Arial;width:100%' LANGUAGE=javascript onclick='return CmdDuyet_onclick()'accesskey="Q"><p><u>Q</u>uy định quyền</p></Button></td>
								<%else%>
									<td width="25%"><Button disabled name='CmdDuyet' style='font-family: Arial;width:100%' LANGUAGE=javascript onclick='return CmdDuyet_onclick()'accesskey="Q"><p><u>Q</u>uy định quyền</p></Button></td>
								<%end if
							end if
						else
							if bComm="add" then							
								if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" or Session("IsAdmin") then%>
									<td width="25%"><Button disabled  name='CmdDuyet' style='font-family: Arial;width:100%' LANGUAGE=javascript onclick='return CmdDuyet_onclick()'accesskey="Q"><p><u>Q</u>uy định quyền</p></Button></td>
								<%else%>
									<td width="25%"><Button disabled name='CmdDuyet' style='font-family: Arial;width:100%' LANGUAGE=javascript onclick='return CmdDuyet_onclick()'accesskey="Q"><p><u>Q</u>uy định quyền</p></Button></td>
								<%end if
							else
								if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" or Session("IsAdmin") then%>
									<td width="25%"><Button name='CmdDuyet' style='font-family: Arial;width:100%' LANGUAGE=javascript onclick='return CmdDuyet_onclick()'accesskey="Q"><p><u>Q</u>uy định quyền</p></Button></td>
								<%else%>
									<td width="25%"><Button disabled name='CmdDuyet' style='font-family: Arial;width:100%' LANGUAGE=javascript onclick='return CmdDuyet_onclick()'accesskey="Q"><p><u>Q</u>uy định quyền</p></Button></td>								
								<%end if
							end if
						end if
					end if%>
	<%if bComm="add" then%>
	<td width="25%"><Button disabled name="CmdXemNoidung" style="font-family: Arial; width:100%" LANGUAGE=javascript onclick="return CmdXemNoidung_onclick()" accesskey="X"><p><u>X</u>em nội dung văn thư</p></Button></td>
	<%else%>
	<td width="25%"><Button name="CmdXemNoidung" style="font-family: Arial;width:100%" LANGUAGE=javascript onclick="return CmdXemNoidung_onclick()" accesskey="X"><p><u>X</u>em nội dung văn thư</p></Button></td>
	<%end if%>	
	<td width="25%"><Button name="CmdAdd" style="font-family: Arial;width:100%"  LANGUAGE=javascript onclick="return CmdAdd_onclick()" accesskey="T"><p><u>T</u>hêm mới</p></Button></td>
</tr>
<tr>
	<%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" or Session("IsAdmin") then%>
		<%if bComm="add" then%>
			<%if bTTDuyet then%>
				<td width="25%"><Button disabled name="CmdOKDuyet" style="font-family: Arial;width:100%"  LANGUAGE=javascript onclick="return CmdOKDuyet_onclick()" accesskey="D"><p><u>D</u>uyệt nội dung</p></Button></td>
			<%else%>
				<td width="25%"><Button disabled name="CmdOKDuyet" style="font-family: Arial;width:100%"  LANGUAGE=javascript onclick="return CmdOKDuyet_onclick()" accesskey="D"><p><u>D</u>uyệt nội dung</p></Button></td>
			<%end if%>
		<%else%>
				<%if bTTDuyet then%>
					<td width="25%"><Button disabled name="CmdOKDuyet" style="font-family: Arial;width:100%"  LANGUAGE=javascript onclick="return CmdOKDuyet_onclick()" accesskey="Đ"><p><u>D</u>uyệt nội dung</p></Button></td>
				<%else%>
					<td width="25%"><Button name="CmdOKDuyet" style="font-family: Arial;width:100%"  LANGUAGE=javascript onclick="return CmdOKDuyet_onclick()" accesskey="DD"><p><u>D</u>uyệt nội dung</p></Button></td>
				<%end if%>
		<%end if%>
	<%else%>					
		<td width="25%"><Button disabled name="CmdOKDuyet" style="font-family: Arial;width:100%"  LANGUAGE=javascript onclick="return CmdOKDuyet_onclick()" accesskey="D"><p><u>D</u>uyệt nội dung</p></Button></td>
	<%end if%>		
	<%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" or Session("IsAdmin") then%>
		<%if bTTDuyet then%>
			<td width="25%"><Button name="CmdNotOKDuyet" style="font-family: Arial;width:100%"  LANGUAGE=javascript onclick="return CmdNotOKDuyet_onclick()" accesskey="H"><p><u>H</u>ủy duyệt nội dung</p></Button></td>
		<%else%>
			<td width="25%"><Button disabled=true name="CmdNotOKDuyet" style="font-family: Arial;width:100%"  LANGUAGE=javascript onclick="return CmdNotOKDuyet_onclick()" accesskey="H"><p><u>H</u>ủy duyệt nội dung</p></Button></td>
		<%end if%>
	<%else%>
		<td width="25%"><Button disabled=true name="CmdNotOKDuyet" style="font-family: Arial;width:100%"  LANGUAGE=javascript onclick="return CmdNotOKDuyet_onclick()" accesskey="H"><p><u>H</u>ủy duyệt nội dung</p></Button></td>
	<%end if%>
	<%if bComm="add" then%>
		<%if bTTDuyet then%>
			<td width="25%"><Button disabled  name="CmdNoidungtep" style=" font-family: Arial; height: 25; position: relative; width:100%" LANGUAGE=javascript onclick="return CmdNoidungtep_onclick()" accesskey="S"><p><u>S</u>oạn nội dung văn thư</p></Button></td>
		<%else%>
			<td width="25%"><Button disabled name="CmdNoidungtep" style=" font-family: Arial; height: 25; position: relative; width:100%" LANGUAGE=javascript onclick="return CmdNoidungtep_onclick()" accesskey="S"><p><u>S</u>oạn nội dung văn thư</p></Button></td>
		<%end if%>
	<%else%>
		<%if bTTDuyet then%>
			<td width="25%"><Button disabled name="CmdNoidungtep" style=" font-family: Arial; height: 25; position: relative; width:100%" LANGUAGE=javascript onclick="return CmdNoidungtep_onclick()" accesskey="S"><p><u>S</u>oạn nội dung văn thư</p></Button></td>
		<%else%>
			<td width="25%"><Button name="CmdNoidungtep" style=" font-family: Arial; height: 25; position: relative; width:100%" LANGUAGE=javascript onclick="return CmdNoidungtep_onclick()" accesskey="S"><p><u>S</u>oạn nội dung văn thư</p></Button></td>
		<%end if%>
	<%end if%>	
	<td width="25%"><Button name="CmdExit" style="font-family: Arial;width:100%" LANGUAGE=javascript onclick="return CmdExit_onclick()" accesskey="Y"><p>Qua<u>y</u> lại</p></Button></td>
</tr>
</table>
</form>
</body>
</html>
<Script language=vbscript runat=server>
</Script>